align status icon display with e.g. Talk more
authorJyrki Gadinger <nilsding@nilsding.org>
Wed, 19 Mar 2025 10:25:09 +0000 (11:25 +0100)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Wed, 19 Mar 2025 12:10:47 +0000 (12:10 +0000)
- status icons have now a white background/border
- "Invisible"/"Offline" icons are now hidden
- UserModel.status property is now available in QML too when needed

Signed-off-by: Jyrki Gadinger <nilsding@nilsding.org>
src/gui/tray/CurrentAccountHeaderButton.qml
src/gui/tray/UserLine.qml
src/gui/tray/usermodel.cpp
src/gui/tray/usermodel.h

index 3b7249704f014702e7c2dd55e63d879641f542e1..061a5d2fbbf9f76e01f268ccf7577be38923514c 100644 (file)
@@ -162,9 +162,11 @@ Button {
                 id: currentAccountStatusIndicatorBackground
                 visible: UserModel.currentUser && UserModel.currentUser.isConnected
                          && UserModel.currentUser.serverHasUserStatus
+                         && UserModel.currentUser.status !== UserStatus.Invisible
+                         && UserModel.currentUser.status !== UserStatus.Offline
                 width: Style.accountAvatarStateIndicatorSize +  + Style.trayFolderStatusIndicatorSizeOffset
                 height: width
-                color: root.parentBackgroundColor
+                color: "white"
                 anchors.bottom: currentAccountAvatar.bottom
                 anchors.right: currentAccountAvatar.right
                 radius: width * Style.trayFolderStatusIndicatorRadiusFactor
@@ -174,6 +176,8 @@ Button {
                 id: currentAccountStatusIndicator
                 visible: UserModel.currentUser && UserModel.currentUser.isConnected
                          && UserModel.currentUser.serverHasUserStatus
+                         && UserModel.currentUser.status !== UserStatus.Invisible
+                         && UserModel.currentUser.status !== UserStatus.Offline
                 source: UserModel.currentUser ? UserModel.currentUser.statusIcon : ""
                 cache: false
                 x: currentAccountStatusIndicatorBackground.x + 1
index 010a9391b08b9363f98df2f5290e9fdfa53c34b3..ea52fb09c2d21276a45e0e4cd8f6eed572270bec 100644 (file)
@@ -50,9 +50,10 @@ AbstractButton {
                 visible: model.isConnected && model.serverHasUserStatus\r
                 width: accountStatusIndicator.sourceSize.width + 2\r
                 height: width\r
+                color: "white"\r
                 anchors.bottom: accountAvatar.bottom\r
                 anchors.right: accountAvatar.right\r
-                radius:  width * Style.trayFolderStatusIndicatorRadiusFactor\r
+                radius: width * Style.trayFolderStatusIndicatorRadiusFactor\r
             }\r
 \r
             Image {\r
index 65229590b3cad30ddc92ca7635e0b4caf5ad6fc2..6cb075b6322921aca0238632d2a1f0d5a4daaad7 100644 (file)
@@ -1349,8 +1349,9 @@ void UserModel::addUser(AccountStatePtr &user, const bool &isCurrent)
         });
 
         connect(u, &User::statusChanged, this, [this, row] {
-            emit dataChanged(index(row, 0), index(row, 0), {UserModel::StatusIconRole, 
-                                                           UserModel::StatusEmojiRole,     
+            emit dataChanged(index(row, 0), index(row, 0), {UserModel::StatusRole,
+                                                            UserModel::StatusIconRole,
+                                                            UserModel::StatusEmojiRole,
                                                             UserModel::StatusMessageRole});
         });
         
@@ -1542,6 +1543,8 @@ QVariant UserModel::data(const QModelIndex &index, int role) const
         return _users[index.row()]->server();
     } else if (role == ServerHasUserStatusRole) {
         return _users[index.row()]->serverHasUserStatus();
+    } else if (role == StatusRole) {
+        return QVariant::fromValue(_users[index.row()]->status());
     } else if (role == StatusIconRole) {
         return _users[index.row()]->statusIcon();
     } else if (role == StatusEmojiRole) {
@@ -1568,6 +1571,7 @@ QHash<int, QByteArray> UserModel::roleNames() const
     roles[NameRole] = "name";
     roles[ServerRole] = "server";
     roles[ServerHasUserStatusRole] = "serverHasUserStatus";
+    roles[StatusRole] = "status";
     roles[StatusIconRole] = "statusIcon";
     roles[StatusEmojiRole] = "statusEmoji";
     roles[StatusMessageRole] = "statusMessage";
index 2d56f0121059521164781cea111ee3dc477ca46d..e4e40e1671e96164a5711c2ee5cba1335eedb27c 100644 (file)
@@ -51,6 +51,7 @@ class User : public QObject
     Q_PROPERTY(QColor headerTextColor READ headerTextColor NOTIFY headerTextColorChanged)
     Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentColorChanged)
     Q_PROPERTY(bool serverHasUserStatus READ serverHasUserStatus CONSTANT)
+    Q_PROPERTY(UserStatus::OnlineStatus status READ status NOTIFY statusChanged)
     Q_PROPERTY(QUrl statusIcon READ statusIcon NOTIFY statusChanged)
     Q_PROPERTY(QString statusEmoji READ statusEmoji NOTIFY statusChanged)
     Q_PROPERTY(QString statusMessage READ statusMessage NOTIFY statusChanged)
@@ -238,6 +239,7 @@ public:
         NameRole = Qt::UserRole + 1,
         ServerRole,
         ServerHasUserStatusRole,
+        StatusRole,
         StatusIconRole,
         StatusEmojiRole,
         StatusMessageRole,